package com.dingwen.treasure.core.config;

import com.dingwen.treasure.base.enums.CaptchaEnum;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

/**
 * 　CaptchaProperties: 验证码配置类
 * 　@author dingwen
 * 　@since  2022/6/11
 */
@Configuration(proxyBeanMethods = false)
@RefreshScope
@ConfigurationProperties(prefix = "treasure.captcha.image")
@Getter
@Setter
public class CaptchaProperties {
    /**
     * 验证码开关: 默认开启
     */
    private Boolean enabled = true;

    /**
     * 验证码类型: 默认线条干扰的验证码
     */
    private CaptchaEnum captchaEnum = CaptchaEnum.LINE_CAPTCHA;

    /**
     * 默认验证码宽度 200
     */
    private Integer width = 200;

    /**
     * 默认验证码高度 100
     */
    private Integer height = 100;

    /**
     * 默认验证码字符个数 5
     */
    private Integer codeCount = 5;

    /**
     * 默认验证码干扰数 15
     */
    private Integer disturbCount = 15;

    /**
     * 验证码有效期: 默认两分钟
     */
    private Long time = 2L;

    /**
     * 验证码有效期： 默认两分钟
     */
    private TimeUnit unit = TimeUnit.MINUTES;
}
